package com.itheima.thread_demo.thread_method;

/*
    Thread类
        public void join​() : 具备阻塞作用 , 等待这个线程死亡,才会执行其他线程
 */
public class JoinDemo {
    public static void main(String[] args) throws InterruptedException {

        // new Thread(Runnable实现类对象).start();
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(3000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                for (int i = 1; i <= 10; i++) {
                    System.out.println(i);
                }
            }
        });
        thread.start();
        thread.join();// 阻塞



        System.out.println("main线程中的内容");


    }
}
